/*      > H.Stack - Stack data type header file */

#ifndef __stack_h

#define __stack_h

struct stack
{
        void *top;      /* pointer to top of stack */
        int obj_size;   /* size of one element */
};

typedef struct stack *stack;

/* General component routines */

stack stk_new (int obj_len);
void stk_free (stack s);
void stk_clear (stack s);
int stk_copy (stack s1, const stack s2);
int stk_equal (const stack s1, const stack s2);
int stk_empty (const stack s);
int stk_size (const stack s);

/* Iterator */

#define STATUS_CONTINUE 0       /* Continue processing */
#define STATUS_STOP     1       /* Stop processing */
#define STATUS_ERROR    (-1)    /* Error - terminate */

int stk_iterate (const stack s, int (*process)(void *));

/* Stack-specific routines */

int stk_push (stack s, const void *object);
int stk_pop (stack s);
void *stk_top (const stack s);

#endif
